package main;
import db.*;
import voidlib.*;
import models.*;
import models.mappers.UserMapper;
/**
 * @author nevidimov
 */
public class InstallController extends VoidController {

    public void tablesAction() {
        DbConnector.createTables();
        this.initModelAndView();
    }
    
    public void usersAction() {
        try {
            UserMapper.CreateUser(1, "bank", "asd123", "", 0, UserRole.Bank);
            UserMapper.CreateUser(1, "admin", "admin", "", 0, UserRole.Admin);
            
        } catch (Exception e) {
            
        }
        this.initModelAndView();
    }
    
    public void usersviewAction() { 
        User user = null;
        try {
            user = new User().getMapper().fetch(2);
        } catch (Exception e) {
           e.printStackTrace(); 
        }
        this.view.put("id", user.getId());
        
        this.initModelAndView();
    }
    
    
    public void indexAction() {
        this.initModelAndView();
    }
}
